import sun.misc.Launcher;

/**
 * Created by MGL on 2017/6/16.
 */
public class Test {
    public static void main(String[] args) {
        //获取系统类加载器
        ClassLoader appClassLoader = Test.class.getClassLoader();
        System.out.println("系统类加载器: " + appClassLoader);
        //获取扩展类加载器
        ClassLoader extClassLoader = appClassLoader.getParent();
        System.out.println("扩展累加载器：" + extClassLoader);
        //获取引导类加载器
        ClassLoader bootClassLoader = extClassLoader.getParent();
        System.out.println("引导类加载器：" + bootClassLoader);
        String bootPath = System.getProperty("sun.boot.class.path");
        String extPath = System.getProperty("java.ext.dirs");
        String classPath = System.getProperty("java.class.path");
        System.out.println("引导类加载器加载类的路径：" + bootPath);
        System.out.println("扩展累加载器加载类的路径：" + extPath);
        System.out.println("系统类加载器加载类的路径：" + classPath);
        Thread thread = new Thread();
        thread.setContextClassLoader(extClassLoader);
        ClassLoader contextClassLoader = thread.getContextClassLoader();
        System.out.println(contextClassLoader);

    }
}
